package org.njyinghuo.sdk.bytedance;

import cn.hutool.core.util.StrUtil;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import org.njyinghuo.sdk.bytedance.client.douyin.DouyinClient;
import org.njyinghuo.sdk.bytedance.exception.DouYinException;

/**
 * @description:字节跳动openApi
 * @author: Hupengpeng
 * @time: 2021/7/2 15:46
 */
public class ByteOpenApi {
    private static final Log log = LogFactory.get();

    /**
     * 获取抖音实例
     *
     * @param clientKey
     * @param clientSecret
     * @return
     */
    public static DouyinClient DouyinInstance(String clientKey, String clientSecret) {
        if (StrUtil.isEmpty(clientKey)) {
            Exceptions("clientKey不能为空！");
        }
        if (StrUtil.isEmpty(clientSecret)) {
            Exceptions("clientSecret不能为空！");
        }
        return new DouyinClient(clientKey, clientSecret);
    }

    /**
     * 扔出参数检测异常
     *
     * @param msg
     */
    public static void Exceptions(String msg) {
        throw new DouYinException(msg);
    }
}
